$(function () {
    var orderNo = getUrlParam("orderNo");
    $("#erpOrderItemTable").jqGrid({
        url: baseURL + 'production/erporderitem/itemAllotVos/'+orderNo,
        datatype: "json",
        colModel: [
            { label: '商品ID', name: 'itemId', width: 50, key: true },
            { label: '商品名称', name: 'name', width: 120 },
            { label: '规格属性', name: 'addon', width: 100 },
            { label: '商品类型', name: 'goodsType', width: 80 },
            { label: '数量', name: 'nums', width: 50 },
            { label: '金额', name: 'price', width: 50 },
            { label: '源文件', name: '', width: 50 },
            { label: '发货图片', name: '', width: 50 },
        ],
        viewrecords: true,
        // height: window.innerHeight - 120,
        rowNum: -1,
        // rowList : [25,50,100],
        rownumbers: true,
        rownumWidth: 25,
        autowidth:true,
        multiselect: true,
        pager: "#jqGridPager",
        jsonReader : {
            // root: "page.list",
            // page: "page.currPage",
            // total: "page.totalPage",
            // records: "page.totalCount"
            root: "erpOrderItemAllotVos",
        },
        // prmNames : {
        //     page:"page",
        //     rows:"limit",
        //     order: "order"
        // },
        gridComplete:function(){
            //隐藏grid底部滚动条
            $("#erpOrderItemTable").closest(".ui-jqgrid-bdiv").css({ "overflow-x" : "hidden" });
        }
    });
});

/**
 * 取得url参数
 */
function getUrlParam(name) {
    var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)"); // 构造一个含有目标参数的正则表达式对象
    var r = window.location.search.substr(1).match(reg);  // 匹配目标参数
    if (r != null) return unescape(r[2]);
    return null; // 返回参数值
}

var vm = new Vue({
	el:'#rrapp',
	data:{
        showList: true,
	},
	methods: {
        //返回
        goBack: function () {
            window.history.go(-1);
        },
    },
});